package com.yww.algorithm.recursion;

/**
 * @author yww
 * @description 递归阶乘
 * @since 2024/1/31 11:24
 */
public final class Factorial {
    public static int f(int n) {
        if (n == 1) { // 结束条件
            return 1;
        }
        return n * f(n - 1);
    }

    public static void main(String[] args) {
        System.out.println(f(5));
    }
}
